use wasm_bindgen::prelude::*;

#[wasm_bindgen]
#[derive(Debug, Clone)]
pub struct Transform {
    x: f32,
    y: f32,
    width: f32,
    height: f32,
}

#[wasm_bindgen]
impl Transform {
    #[wasm_bindgen(constructor)]
    pub fn new(x: f32, y: f32, width: f32, height: f32) -> Transform {
        Transform {
            x,
            y,
            width,
            height,
        }
    }

    #[wasm_bindgen(getter)]
    pub fn x(&self) -> f32 {
        self.x
    }

    #[wasm_bindgen(setter)]
    pub fn set_x(&mut self, value: f32) {
        self.x = value;
    }

    #[wasm_bindgen(getter)]
    pub fn y(&self) -> f32 {
        self.y
    }

    #[wasm_bindgen(setter)]
    pub fn set_y(&mut self, value: f32) {
        self.y = value;
    }

    #[wasm_bindgen(getter)]
    pub fn width(&self) -> f32 {
        self.width
    }

    #[wasm_bindgen(setter)]
    pub fn set_width(&mut self, value: f32) {
        self.width = value;
    }

    #[wasm_bindgen(getter)]
    pub fn height(&self) -> f32 {
        self.height
    }

    #[wasm_bindgen(setter)]
    pub fn set_height(&mut self, value: f32) {
        self.height = value;
    }
}